# long 爬虫
# {2021/9/7}
# 本章目的：
import re
# # 列表模式
# str = "我拍的的10086，老婆的是10000，我的10010"
#
# lit = re.findall(r"\d+",str)
#
# print(lit)
#
# # 迭代器模式finditer用group()拿到内容
#
# it = re.finditer(r"\d+",str)
# for i in it:
#     print(i.group())
# # print(it)
#
# # search返回结果是match对象用group()拿内容，找到一个结果就返回
# s = re.search(r"\d+",str)
# print(s.group())

obj = re.compile(r"\d+")

s = """
<div class='jac'><span id='1'>老特</span></div>
<div class='jxc'><span id='2'>我的</span></div>
<div class='ggg'><span id='3'>名字</span></div>
<div class='qq'><span id='4'>伊娃</span></div>
<div class='w'><span id='5'>空间</span></div>
"""
obj = re.compile(r"<div class='(?P<calss>.*?)'><span id='(?P<id>.\d+)'>(?P<name>.*?)</span></div>",re.S)

result = obj.finditer(s)

for i in result:
    print(i)